home *** CD-ROM | disk | FTP | other *** search
/ SoundMaker 2003 (Professional Edition) / SoundMaker 2003 - Professional Edition.iso / midi tool / midioxse.exe / DATA.1 / arrayx.CLS < prev    next >
Text File  |  1999-03-27  |  3KB  |  95 lines

  1. /****************************************************************************/
  2. /* Name: ArrayX                                                             */
  3. /* Type: Object REXX Class Definition                                       */
  4. /* Author:   Jamie O'Connell                                                */
  5. /* Resource:                                                                */
  6. /*                                                                          */
  7. /* Description: Extended Array Class                                        */
  8. /*                                                                          */
  9. /* Public Classes:                                                          */
  10. /*                                                                          */
  11. /* Public Routines:                                                         */
  12. /*                                                                          */
  13. /*                                                                          */
  14. /* Coypright (C) Jamie O'Connell, 1998. All Rights Reserved.                */
  15. /*                                                                          */
  16. /****************************************************************************/
  17.  
  18.  
  19. /* ::requires ".CLS" */  /* uncomment if you require another file */
  20.  
  21.  
  22. /*-------------------------- Class /**/ -----------------------------------*/
  23.  
  24. ::class ArrayX subclass Array public
  25.  
  26. /* class attributes */
  27.  
  28. ::method INIT                        /* constructor */
  29.    forward class(super) continue     /* call parent constructor */
  30.    return 
  31.  
  32. /* ------------------------------------------------------------- */
  33. /* class methods */
  34.  
  35. ::method Remove
  36.     use Arg n
  37.     
  38.    self~Remove:super( n )
  39.    if self~Last = .NIL then  /* empty array */
  40.       return
  41.  
  42.     do ii = n to self~Last
  43.         self~Put( self~At( ii + 1 ), ii )
  44.     end
  45.  
  46.    return
  47.  
  48. /* ------------------------------------------------------------- */
  49. /* this adds an object to the end                                */
  50.  
  51. ::method Add
  52.     use Arg obj
  53.     
  54.     self~Put( obj, self~HiBound() + 1 )
  55.    return
  56.  
  57.     
  58. /* ------------------------------------------------------------- */
  59. /* this does a real insert *before* this index supplied          */
  60.  
  61. ::method Insert
  62.     use Arg obj, n
  63.     
  64.    do ii = self~HiBound() to n by -1
  65.         self~Put( self~At( ii ), ii + 1 )
  66.     end
  67.  
  68.     self~Put( obj, n )
  69.    return
  70.  
  71. /* ------------------------------------------------------------- */
  72. /* We don't seem to be able to control or influence Items and    */
  73. /* First or Last. This provides a counter workaround (expensive) */
  74.  
  75. ::method HiBound 
  76.  
  77.     do ii = 1 by 1
  78.         if self~At( ii ) = .NIL then
  79.             return ii - 1
  80.     end
  81.     
  82.     return
  83.         
  84. /* ------------------------------------------------------------- */
  85. /* Simple indicator of empty or not                              */
  86.  
  87. ::method IsEmpty 
  88.  
  89.     do ii = 1 to self~Items
  90.         if self~At( ii ) <> .NIL then
  91.             return .FALSE
  92.     end
  93.     
  94.     return .TRUE
  95.